<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>处理管理员登录页面</title>
</head>
<body>
	<?php 
     //接收表单数据


    mysql_connect("localhost","root","");
    mysql_select_db("neuvideo");
    mysql_set_charset("utf8");


	$adminname=$_POST["adminname"];
	$password=$_POST["password"];

    $sql="select* from admins where adminname='$adminname' and password=md5('$password')";
    echo $sql."<br>";
    $result=mysql_query($sql);//结果集
    $num=mysql_num_rows($result);
    if($num>0){//查到了
    	//将管理员的名字和adminID记录到session中
       // $row=mysql_num_rows($result);
        $row=mysql_fetch_assoc($result);
    	session_start();//启动session(会话)
    	$_SESSION["adminname"]=$adminname;
        $_SESSION["adminid"]=$row["adminid"];
        // var_dump($row["adminid"]);

    	echo"login success";
    	header("location:welcome.php");
    }
    else{
    	echo"login failed";
    	header("location:index.php");
    }



	 ?>
</body>
<html>
